Optimal. Leaf size=193 \[ \frac{d^2 \left (12 c^2-16 c d+7 d^2\right ) \tanh ^{-1}(\sin (e+f x))}{2 a^2 f}-\frac{d \tan (e+f x) \left (d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)+4 \left (8 c^2 d+c^3-20 c d^2+8 d^3\right )\right )}{6 a^2 f}+\frac{(c-d) (c+8 d) \tan (e+f x) (c+d \sec (e+f x))^2}{3 f \left (a^2 \sec (e+f x)+a^2\right )}+\frac{(c-d) \tan (e+f x) (c+d \sec (e+f x))^3}{3 f (a \sec (e+f x)+a)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.320114, antiderivative size = 249, normalized size of antiderivative = 1.29, number of steps used = 7, number of rules used = 7, integrand size = 31, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.226, Rules used = {3987, 98, 150, 147, 63, 217, 203} \[ -\frac{d \tan (e+f x) \left (d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)+4 \left (8 c^2 d+c^3-20 c d^2+8 d^3\right )\right )}{6 a^2 f}+\frac{(c-d) (c+8 d) \tan (e+f x) (c+d \sec (e+f x))^2}{3 f \left (a^2 \sec (e+f x)+a^2\right )}+\frac{d^2 \left (12 c^2-16 c d+7 d^2\right ) \tan (e+f x) \tan ^{-1}\left (\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a (\sec (e+f x)+1)}}\right )}{a f \sqrt{a-a \sec (e+f x)} \sqrt{a \sec (e+f x)+a}}+\frac{(c-d) \tan (e+f x) (c+d \sec (e+f x))^3}{3 f (a \sec (e+f x)+a)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3987
Rule 98
Rule 150
Rule 147
Rule 63
Rule 217
Rule 203
Rubi steps
\begin{align*} \int \frac{\sec (e+f x) (c+d \sec (e+f x))^4}{(a+a \sec (e+f x))^2} \, dx &=-\frac{\left (a^2 \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{(c+d x)^4}{\sqrt{a-a x} (a+a x)^{5/2}} \, dx,x,\sec (e+f x)\right )}{f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}+\frac{\tan (e+f x) \operatorname{Subst}\left (\int \frac{(c+d x)^2 \left (-a^2 \left (c^2+5 c d-3 d^2\right )+a^2 (2 c-5 d) d x\right )}{\sqrt{a-a x} (a+a x)^{3/2}} \, dx,x,\sec (e+f x)\right )}{3 a f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{(c-d) (c+8 d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )}+\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}+\frac{\tan (e+f x) \operatorname{Subst}\left (\int \frac{(c+d x) \left (-a^4 (19 c-16 d) d^2+a^4 d \left (2 c^2+16 c d-21 d^2\right ) x\right )}{\sqrt{a-a x} \sqrt{a+a x}} \, dx,x,\sec (e+f x)\right )}{3 a^4 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{(c-d) (c+8 d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )}+\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}-\frac{d \left (4 \left (c^3+8 c^2 d-20 c d^2+8 d^3\right )+d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)\right ) \tan (e+f x)}{6 a^2 f}-\frac{\left (d^2 \left (12 c^2-16 c d+7 d^2\right ) \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{a-a x} \sqrt{a+a x}} \, dx,x,\sec (e+f x)\right )}{2 f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{(c-d) (c+8 d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )}+\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}-\frac{d \left (4 \left (c^3+8 c^2 d-20 c d^2+8 d^3\right )+d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)\right ) \tan (e+f x)}{6 a^2 f}+\frac{\left (d^2 \left (12 c^2-16 c d+7 d^2\right ) \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{\sqrt{2 a-x^2}} \, dx,x,\sqrt{a-a \sec (e+f x)}\right )}{a f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{(c-d) (c+8 d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )}+\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}-\frac{d \left (4 \left (c^3+8 c^2 d-20 c d^2+8 d^3\right )+d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)\right ) \tan (e+f x)}{6 a^2 f}+\frac{\left (d^2 \left (12 c^2-16 c d+7 d^2\right ) \tan (e+f x)\right ) \operatorname{Subst}\left (\int \frac{1}{1+x^2} \, dx,x,\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a+a \sec (e+f x)}}\right )}{a f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}\\ &=\frac{d^2 \left (12 c^2-16 c d+7 d^2\right ) \tan ^{-1}\left (\frac{\sqrt{a-a \sec (e+f x)}}{\sqrt{a+a \sec (e+f x)}}\right ) \tan (e+f x)}{a f \sqrt{a-a \sec (e+f x)} \sqrt{a+a \sec (e+f x)}}+\frac{(c-d) (c+8 d) (c+d \sec (e+f x))^2 \tan (e+f x)}{3 f \left (a^2+a^2 \sec (e+f x)\right )}+\frac{(c-d) (c+d \sec (e+f x))^3 \tan (e+f x)}{3 f (a+a \sec (e+f x))^2}-\frac{d \left (4 \left (c^3+8 c^2 d-20 c d^2+8 d^3\right )+d \left (2 c^2+16 c d-21 d^2\right ) \sec (e+f x)\right ) \tan (e+f x)}{6 a^2 f}\\ \end{align*}
Mathematica [A] time = 2.83186, size = 310, normalized size = 1.61 \[ \frac{2 \sin \left (\frac{1}{2} (e+f x)\right ) \cos \left (\frac{1}{2} (e+f x)\right ) \sec ^2(e+f x) \left (-24 c^2 d^2 \cos (3 (e+f x))+6 \left (-12 c^2 d^2+2 c^3 d+c^4+28 c d^3-10 d^4\right ) \cos (e+f x)+\left (-60 c^2 d^2+16 c^3 d+2 c^4+112 c d^3-43 d^4\right ) \cos (2 (e+f x))-60 c^2 d^2+4 c^3 d \cos (3 (e+f x))+16 c^3 d+2 c^4 \cos (3 (e+f x))+2 c^4+40 c d^3 \cos (3 (e+f x))+112 c d^3-16 d^4 \cos (3 (e+f x))-37 d^4\right )-24 d^2 \left (12 c^2-16 c d+7 d^2\right ) \cos ^4\left (\frac{1}{2} (e+f x)\right ) \left (\log \left (\cos \left (\frac{1}{2} (e+f x)\right )-\sin \left (\frac{1}{2} (e+f x)\right )\right )-\log \left (\sin \left (\frac{1}{2} (e+f x)\right )+\cos \left (\frac{1}{2} (e+f x)\right )\right )\right )}{12 a^2 f (\cos (e+f x)+1)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [B] time = 0.083, size = 514, normalized size = 2.7 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] time = 1.04037, size = 724, normalized size = 3.75 \begin{align*} \text{result too large to display} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A] time = 0.518773, size = 841, normalized size = 4.36 \begin{align*} \frac{3 \,{\left ({\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{4} + 2 \,{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{3} +{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{2}\right )} \log \left (\sin \left (f x + e\right ) + 1\right ) - 3 \,{\left ({\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{4} + 2 \,{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{3} +{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \cos \left (f x + e\right )^{2}\right )} \log \left (-\sin \left (f x + e\right ) + 1\right ) + 2 \,{\left (3 \, d^{4} + 4 \,{\left (c^{4} + 2 \, c^{3} d - 12 \, c^{2} d^{2} + 20 \, c d^{3} - 8 \, d^{4}\right )} \cos \left (f x + e\right )^{3} +{\left (2 \, c^{4} + 16 \, c^{3} d - 60 \, c^{2} d^{2} + 112 \, c d^{3} - 43 \, d^{4}\right )} \cos \left (f x + e\right )^{2} + 6 \,{\left (4 \, c d^{3} - d^{4}\right )} \cos \left (f x + e\right )\right )} \sin \left (f x + e\right )}{12 \,{\left (a^{2} f \cos \left (f x + e\right )^{4} + 2 \, a^{2} f \cos \left (f x + e\right )^{3} + a^{2} f \cos \left (f x + e\right )^{2}\right )}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F] time = 0., size = 0, normalized size = 0. \begin{align*} \frac{\int \frac{c^{4} \sec{\left (e + f x \right )}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec{\left (e + f x \right )} + 1}\, dx + \int \frac{d^{4} \sec ^{5}{\left (e + f x \right )}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec{\left (e + f x \right )} + 1}\, dx + \int \frac{4 c d^{3} \sec ^{4}{\left (e + f x \right )}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec{\left (e + f x \right )} + 1}\, dx + \int \frac{6 c^{2} d^{2} \sec ^{3}{\left (e + f x \right )}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec{\left (e + f x \right )} + 1}\, dx + \int \frac{4 c^{3} d \sec ^{2}{\left (e + f x \right )}}{\sec ^{2}{\left (e + f x \right )} + 2 \sec{\left (e + f x \right )} + 1}\, dx}{a^{2}} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] time = 1.30644, size = 508, normalized size = 2.63 \begin{align*} \frac{\frac{3 \,{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 1 \right |}\right )}{a^{2}} - \frac{3 \,{\left (12 \, c^{2} d^{2} - 16 \, c d^{3} + 7 \, d^{4}\right )} \log \left ({\left | \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 1 \right |}\right )}{a^{2}} - \frac{6 \,{\left (8 \, c d^{3} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} - 5 \, d^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} - 8 \, c d^{3} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 3 \, d^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )\right )}}{{\left (\tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{2} - 1\right )}^{2} a^{2}} - \frac{a^{4} c^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} - 4 \, a^{4} c^{3} d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} + 6 \, a^{4} c^{2} d^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} - 4 \, a^{4} c d^{3} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} + a^{4} d^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )^{3} - 3 \, a^{4} c^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 12 \, a^{4} c^{3} d \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 54 \, a^{4} c^{2} d^{2} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) - 60 \, a^{4} c d^{3} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right ) + 21 \, a^{4} d^{4} \tan \left (\frac{1}{2} \, f x + \frac{1}{2} \, e\right )}{a^{6}}}{6 \, f} \end{align*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]